<!-- <h1>Listing products</h1>

<table>
  <thead>
    <tr>
      <th>Title</th>
      <th>Description</th>
      <th>Image url</th>
      <th>Price</th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @products.each do |product| %>
      <tr>
        <td><%= product.title %></td>
        <td><%= product.description %></td>
        <td><%= product.image_url %></td>
        <td><%= product.price %></td>
        <td><%= link_to 'Show', product %></td>
        <td><%= link_to 'Edit', edit_product_path(product) %></td>
        <td><%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Product', new_product_path %> -->

<div id="product_list">
  <h1>商品列表</h1>

  <table>
  <% @products.each do |product| %>
    <tr class="<%= cycle('list_line_odd', 'list_line_even') %>">

      <td>
        <%= image_tag(product.image_url, :class => 'list_image') %>
      </td>

      <td class="list_description">
        <dl>
          <dt><%= product.title %></dt>
          <dd><%= truncate(strip_tags(product.description),
                 :length => 80) %></dd>
        </dl>
      </td>

      <td class="list_actions">
        <%= link_to '显示商品详情', product, id: "link_show"%><br/>
        <%= link_to '修改商品信息', edit_product_path(product),id: "link_edit"%><br/>
        <!-- <%= link_to 'Destroy', product,
                    :confirm => 'Are you sure?',
                    :method => :delete %> -->
	        <%= link_to '删除商品', product,
	                    method: :delete,
						data: { confirm: "你确定要删吗亲?" },
						id: "link_destroy"  %>
      </td>
    </tr>
  <% end %>
  </table>
</div>

<br />

<%= link_to '添加商品', new_product_path,id: "link_new" %>
<p><%= will_paginate @products %></p>
